<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>广东省传播平台-项目费用结算表查看页</title>
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/common.css" />
		<link rel="stylesheet" type="text/css"
			href="<%=request.getContextPath()%>/css/tag.css" />
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/js/jquery-1.7.2.js">
		</script>
		<script type="text/javascript"
			src="<%=request.getContextPath()%>/js/My97DatePicker/WdatePicker.js">
		</script>
		
		<link type="text/css" rel="stylesheet" href="<%=request.getContextPath()%>/css/zTreeStyle/zTreeStyle.css" />	
		<link type="text/css" href="<%=request.getContextPath()%>/js/jquery-ui-1.8.21.custom/css/smoothness/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.ztree.core-3.1.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.ztree.excheck-3.1.min.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-ui-1.8.21.custom/js/jquery-ui-1.8.21.custom.min.js">
		</script>
		<script type="text/javascript">
	//  关键字的聚焦事件 
		function changeKeyword()
	    {				
		//提交
		  var inputkeyword =  document.getElementById("inputKeyword").value;
		  if(inputkeyword=='输入媒体名称关键字')
		  {
			   $('#inputKeyword').val('');
		  }
	    }

	 //重置
	    function resetFun()
	    {
			document.getElementById("inputKeyword").value="输入媒体名称关键字";
			document.getElementById("cityUser").value="${logUser.usercity}";
			document.getElementById("startMonth").value="";
			document.getElementById("endMonth").value="";
			//隐藏报表导出按钮
			document.getElementById("exportE").style.display ="none";
	    }
     //导出报表
     function exportExcel()
     {
    	 var startMon = $.trim(document.getElementById("startMonth").value);
    	 var endMon = $.trim(document.getElementById("endMonth").value);
    	 var cityUs = $.trim(document.getElementById("cityUser").value);
    	 var inkeyW = $.trim(document.getElementById("inputKeyword").value);
    	 var url = encodeURI(encodeURI("exportExcelProjectPrice.action?startMonth=" +startMon+
    	                                                     "&endMonth="+endMon+
    	                                                     "&userCity="+cityUs+
    	                                                     "&inputKeyword="+inkeyW));
    	 window.location.href = url;
     }
   
     //提交表单
  	     function doSubmit(url){
				document.forms[0].action=url;
				document.forms[0].submit();
			}
     //分页
         function pageSub(currentPage) {
			var reg = /^\d*?$/;
			var total =${page.totalPages};
				 if(reg.test(currentPage)){
				 	if(currentPage > total){
				 		$("#currentPage").val(total);
				 	}else{
				 		$("#currentPage").val(currentPage);
				 	}
				 	
					document.forms[0].action="ProjectPriceAction.action";
					document.forms[0].submit();
				}else{
					  alert("请输入数字!"); 
				}
			}
     
     //搜索
      function search()
     {
    	 var startMonth = document.getElementById("startMonth").value;
    	 if(startMonth==null||''==startMonth)
    	 {
    		 alert('请输入搜索月份！');
    		 return false;
    	 }
    	 var endMonth = document.getElementById("endMonth").value;
    	 if(endMonth==null||''==endMonth)
    	 {
    		 alert('请输入搜索截止月份！');
    		 return false;
    	 }
    	 if(endMonth<startMonth)
   		 {
    		 alert('结束月份不能小于开始月份！');
    		 return false;
   		 }
    	 var inputKey = $.trim(document.getElementById("inputKeyword").value);
    	 var myReg = /^[^@\/\'\\\"#$%&\^\*<>]+$/;
    	 document.getElementById("inputKeyword").value = inputKey;
         if (inputKey != null && inputKey != '' && !myReg.test(inputKey)) 
         {
		    alert("关键字不能包含：“$、#、%、/、*、<、>、'、\"、\\、& ”等特殊字符，请重新输入！");
		    document.getElementById('inputKeyword').focus();
		    return false;
          }
    	 doSubmit('ProjectPriceAction.action');
    	//显示导出报表按钮
    	 document.getElementById("exportE").style.display ="";
     }
     function hideExport()
     {
    	 			//隐藏报表导出按钮
			document.getElementById("exportE").style.display ="none";
     }
     </script>
	</head>
	<body>
	<jsp:include page="../common/top.jsp"></jsp:include>
		<!-- 顶部start -->
		<div id="main">
			<div class="body">
			<jsp:include page="../common/nav.jsp"></jsp:include>
				<!-- 主体 -->
				<div class="main_body">
					<form action="" method="post" >
					<input type="hidden" name="type" value="${type}"/>
					<h3 style="color:#000000; font-size:14px;height: 20px;
					background: url(images/banners30.jpg) repeat-x;
					margin-bottom: 2px;">项目费用报表</h3>
						<table class="condition bg1" id="tableExcel"
							style="width: 100%; font-size: 14px; font-weight: bold; color: #000000;"
							align="center">
							<tr>
								<td width="8%" style="height: 40px; text-align:right;">
									<label>
										月份：
									</label>
	                       	     </td>  
	                       	     <td width="30%" style="height: 40px;" colspan="2">
									<input type="text" class="text Wdate" name="startMonth" id="startMonth" value="${startMonth}"
									style= "text-valign:middle;  "
									onfocus="WdatePicker({dateFmt:'yyyy-MM'})" 
									onclick="hideExport()"
									/>
									-
									<input type="text" class="text Wdate" name="endMonth" id="endMonth" value="${endMonth}"
									style= "text-valign:middle; "
									onfocus="WdatePicker({dateFmt:'yyyy-MM'})"
									onclick="hideExport()"
									 />
	                       	     </td >
	                       	     <td width="15%" style="height: 40px;">
									<s:select name="userCity" list="dataListUserCITY" id="cityUser" listKey="id" listValue="datavalue" onchange="hideExport();" >
									</s:select>
								</td>
	                       	     <td width="15%" style="height: 40px;">
	                       	     <input type="text" class="text" name="inputKeyword" id="inputKeyword" value="${inputKeyword}" onclick="hideExport();"
	                       	      style= "text-valign:middle; line-height:23px; " onfocus="changeKeyword();" onblur="if(this.value=='')this.value='输入媒体名称关键字'"
									/>
	                       	     </td>
								 <td style="height: 40px;  text-align: left;" colspan="2">
									<input name="button" type="button" class="btn-title" value="搜索"
										onclick="search()" />
									&nbsp;&nbsp;&nbsp;
									<input name="button" type="button" class="btn-title" value="重置" 
									     onclick="resetFun()"/>
								 </td>
	                       	     <td  id="exportE" style="height: 40px; text-align:right;" valign="middle">
	                       	     <s:if test="startMonth != null && startMonth != ''">
								           <input name="button" type="button" class="btn-title" value="导出表格"
										onclick="exportExcel();" />
								</s:if>
	                       	     </td> 
							</tr>
						</table>
						<s:if test="startMonth != null && startMonth != ''">
						<div id="list_div">
						<input type="hidden" name="currentPage" id="currentPage" />
							<table class="table_list" style="width: 100%; ">
								<tr class="bg">
									<th>
										序号
									</th>
									<th>
										项目名称
									</th>
									<th>
										媒体名称
									</th>
									<th>
										合同编号
									</th>
									<th>
										费用类型
									</th>
									<th>
										费用子类
									</th>
									<th>
										结算金额
									</th>
								</tr>
								<s:iterator value="dataListProjectPrice" id="clist" status="list">
								<tr>
									<td >
									${list.index+1}
									</td>
									<td title="${clist.projectName}">
										${fn:substring(clist.projectName, 0, 12) }
									</td>
									<td title="${clist.mediaName}">
										${fn:substring(clist.mediaName, 0, 12) }
									</td>
									<td title="${clist.contractID}">
									    ${fn:substring(clist.contractID, 0, 12) }
									</td>
									<td title="${clist.costTypeName}">
									    ${fn:substring(clist.costTypeName, 0, 12) }
									</td>
									<td title="${clist.costSubTypeName}">
									 ${fn:substring(clist.costSubTypeName, 0, 12) }
									</td>
									<td title="${clist.fundAmount}">
									<fmt:formatNumber value="${clist.fundAmount}"/>
									</td>
								</tr>
								</s:iterator>
							</table>
							<!-- 分页 -->
							<jsp:include page="/jsp/common/page.jsp"></jsp:include>
						</div>
						</s:if>
					</form>
				</div>
			</div>
			</div>
		<jsp:include page="/jsp/common/bottom.jsp"></jsp:include>
	</body>
	
	
</html>
